import api from "@/common/api.js"
function doLogin(param, callback) {
	console.log("doLogin")
	api.postRequest("/login/in", param).then(res => {
		console.log(res)
		if (res.code == 0) {
			//记住密码，将登录成功的标识(token)储存到localStorage中，并且跳转到主页
			api.setToken(res.data.token);
			api.setUserInfo(res.data.employee);
			callback && callback();
		} else {
			uni.showToast({
				title: res.msg,
				icon: "error",
				duration: 1000
			});
		}
	});
}



export default {
	doLogin,
	api
};
